import { http } from "@/utils/http";
import { AxiosPromise } from "axios";
import { ReportForm, ReportQuery, ReportVO } from "./type";

/**
 * 查询行业报告列表
 * @param query
 * @returns {*}
 */

export const listReport = (query?: ReportQuery): AxiosPromise<ReportVO[]> => {
  return http.request({
    url: "/wiki/report/list",
    method: "get",
    params: query
  });
};

/**
 * 查询行业报告详细
 * @param id
 */
export const getReport = (id: string | number): AxiosPromise<ReportVO> => {
  return http.request({
    url: "/wiki/report/" + id,
    method: "get"
  });
};

/**
 * 新增行业报告
 * @param data
 */
export const addReport = (data: ReportForm) => {
  return http.request({
    url: "/wiki/report",
    method: "post",
    data: data
  });
};

/**
 * 修改行业报告
 * @param data
 */
export const updateReport = (data: ReportForm) => {
  return http.request({
    url: "/wiki/report",
    method: "put",
    data: data
  });
};

/**
 * 删除行业报告
 * @param id
 */
export const delReport = (id: string | number | Array<string | number>) => {
  return http.request({
    url: "/wiki/report/" + id,
    method: "delete"
  });
};

export function reportLabelsList(query: any): AxiosPromise<any[]> {
  return http.request({
    url: '/wiki/reportLabels/list',
    method: 'get',
    params: query
  });
}

export function reportLabelsListAll(): AxiosPromise<any[]> {
  return http.request({
    url: '/wiki/reportLabels/getLabelsList',
    method: 'get'
  });
}
